package com.co.utils;

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JPanel;

public class ImagePanel extends JPanel{

    private BufferedImage image;

    public ImagePanel() {
    }
    
    public ImagePanel(String imagePath) {
        try {                
           image = ImageIO.read(new File(imagePath));
        } catch (IOException ex) {
        }
     }

    
    public BufferedImage getImage() {
		return image;
	}
  

	public void setImage(String imagePath) {
		try {
			this.image = ImageIO.read(new File(imagePath));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	@Override
    public void paintComponent(Graphics g) {
        g.drawImage(image, 0, 0, null); // see javadoc for more info on the parameters

    }

}